from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User

# Create your models here.
class UploadedImage(models.Model):
    imagepath = models.FileField(upload_to='me')
    rating = models.CharField(max_length=1)
    owner = models.ForeignKey(User)
    date = models.DateTimeField(auto_now=True)
    times_visited = models.IntegerField()
    
    def __unicode__(self):
        return self.imagepath.name
    
class UploadedImageAdmin(admin.ModelAdmin):
    list_display = ('owner', 'imagepath', 'date')
    
admin.site.register(UploadedImage, UploadedImageAdmin)
